package {{cookiecutter.package}};

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class App
{
    public static void main( String[] args )
    {
        try {
            CountDownLatch counter = new CountDownLatch(1);
            ExecutorService pool = Executors.newFixedThreadPool(1);
//            runUdpServer();
            runWebSocketServer();

        }catch (Exception ex){
            ex.printStackTrace();
        }
    }

    public static void runUdpServer() throws Exception{
        UDPServer server = new UDPServer();
        server.start("localhost",8443);
    }

    public static void runWebSocketServer() throws Exception{
        WebSocketServer server = new WebSocketServer();
        server.start(8443);
    }

    public static void runClient(){
        String url = "wss://spot-webwss.bit.com/";
        String requestCommand = "{\"type\":\"subscribe\",\"interval\":\"100ms\",\"channels\":[\"order_book.1.10\"],\"pairs\":[\"ETH-USDT\"]}";
        WebSocketClient client = new WebSocketClient();
        try {
            client.open(url);
            client.send(requestCommand);
            Thread.sleep(1000000);
        }catch (Exception ex){
            ex.printStackTrace();
        }
    }
}
